from django.shortcuts import render
from home import models,ser
from rest_framework import viewsets
from rest_framework.views import APIView
from rest_framework.response import Response
# Create your views here.


class NavModelView(viewsets.ModelViewSet):
  queryset = models.NavModel.objects.all()
  serializer_class = ser.NavModelSerializer


class NavHome(APIView):
  def get(self, request):
    nav = request.query_params.get('pos')
    navhome = models.NavModel.objects.filter(position=nav , isshow=True).order_by('order')
    serhome = ser.NavModelSerializer(navhome, many=True)
    return Response({"msg": "success", "data": serhome.data})
